﻿using System;
using System.Collections.Generic;
using System.Text;
using SHDocVw;
using mshtml;

namespace BindingIEBrowser
{
    public class HDFrameItems
    {

        public HDFrameItems(HTMLWindow2Class _htmlWindow2Class)
        {
            
            
            try
            {
                //_htmlWindow2Class.document.
                this.Name = _htmlWindow2Class.name;



                this.InnerHtml = _htmlWindow2Class.document.body.innerHTML;
                this.InnerText = _htmlWindow2Class.document.body.innerText;
                this.OuterHtml = _htmlWindow2Class.document.body.outerHTML;
                this.OuterText = _htmlWindow2Class.document.body.outerText;

                //if ("data_frm".Equals(this.Name))
                //{
                //    var tt = _htmlWindow2Class.document.frames.item(3) as HTMLWindow2Class;
                //    HTMLDocumentClass tt1 = null;
                //    if (tt != null) tt1 = tt.document as HTMLDocumentClass;
                //    var e1 = tt1.getElementById("TEXTAREAQUESTION") as IHTMLElement;
                //    this.InnerText = e1.getAttribute("value").ToString();

                //    var e2 = tt1.getElementById("TEXTAREAANSWER") as IHTMLElement;
                //    e2.setAttribute("value","asdqwe");
                //    this.OuterText = e2.getAttribute("value").ToString();
                //}
            }
            catch (Exception)
            {
                this.Name = "Access is denied!";
                //this.InnerHtml = "Access is denied!";
                //this.InnerText = "Access is denied!";
                //this.OuterHtml = "Access is denied!";
                //this.OuterText = "Access is denied!";
            }

        }
        public string Name { get; private set; }

        public string InnerHtml { get; private set; }

        public string InnerText { get; private set; }//Classic

        public string OuterHtml { get; private set; }

        public string OuterText { get; private set; }
    }
}
